<?php 
    include_once "../inc/docroot.php";
    include_once PATH."inc/class.autores.inc.php";
    $autores = new autores($db);
    $campaign_id = $_GET['campaign'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../style.css" type="text/css" />
</head>

<body>
<div id="message">
	<div class="autores_header">
    	<br />
        <br />
		<label>
			CAMPAIGN INFORMATION
		</label>
	</div>
    
    <div id="addnewalias" style="text-align:center;">
        <br/>
	 <label> <font color="green">Tips: Add as many sender emails as you can to reduce the risk of sender mail and mail-server getting </font><font color="blue">blacklisted.</font></label>
        <br/>
        <br/>
    	<a href="javascript:aliasadd('addnewalias.php?campaign=<?php echo $campaign_id; ?>','aliasadd','640','480','center','front');" class="btn btn--blue btn--m">
        Add SENDER MAILS</a>
        
        <br/>
        <br/>
<?php
        if($autores->smtpUser($_SESSION['Username']) && !$autores->isexisttakethemail($campaign_id)){
            ?>
            <a href="javascript:aliasadd('gennewalias.php?campaign=<?php echo $campaign_id; ?>','aliasadd','640','480','center','front');" class="btn btn--blue btn--m">
        Generate SENDER MAILS</a>
        <?php
        }
?>         
    <div>
    
    <div id="aliaslist" align="center">
    	<br />
<?php    	include_once PATH."autores/aliaslist.php" ?>
	    <br />
    </div>    
    
    <div id="addnewmessage" style="text-align:center;">
        <br/>
    	<a href="javascript:messageadd('addnewmessage.php?campaign=<?php echo $campaign_id; ?>','messageadd','640','480','center','front');" class="btn btn--blue btn--m">
        Add New MESSAGE</a>
    <div>
    <div id="messagelist" align="center">
    	<br />
<?php    	include_once PATH."autores/messagelist.php" ?>
		<br />
    </div>
    
</div>

<div id="delaymessage">
    <div id="addnewmessage" style="text-align:center;">
    	<br />
        <br />
    	<a href="javascript:delaymessageadd('addnewdelaymessage.php?campaign=<?php echo $campaign_id; ?>','delaymessageadd','640','480','center','front');" class="btn btn--blue btn--m">
        Add New FOLLOW UP MESSAGE</a>
    <div>
    <div id="delaymessagelist" align="center">
    	<br />
<?php    	include_once PATH."autores/delaymessagelist.php" ?>
		<br />
    </div>
    
</div>
<br />
<br />

</body>

<SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'>
<!--
var primarymessageaddWindow=null;
function messageadd(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
primarymessageaddWindow=window.open('',myname+(new Date()).getTime(),settings);
if(infocus=='front'){primarymessageaddWindow.focus();primarymessageaddWindow.location=mypage;}
if(infocus=='back'){primarymessageaddWindow.blur();primarymessageaddWindow.location=mypage;primarymessageaddWindow.blur();}

}

var delaymessageaddWindow=null;
function delaymessageadd(mypage,myname,w,h,pos,infocus){
	
if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';delaymessageaddWindow=window.open('',myname+(new Date()).getTime(),settings);
if(infocus=='front'){delaymessageaddWindow.focus();delaymessageaddWindow.location=mypage;}
if(infocus=='back'){delaymessageaddWindow.blur();delaymessageaddWindow.location=mypage;delaymessageaddWindow.blur();}

}

var primarymessageeditWindow=null;
function messageedit(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';primarymessageeditWindow=window.open('',myname+(new Date()).getTime(),settings);
if(infocus=='front'){primarymessageeditWindow.focus();primarymessageeditWindow.location=mypage;}
if(infocus=='back'){primarymessageeditWindow.blur();primarymessageeditWindow.location=mypage;primarymessageeditWindow.blur();}

}

var primarymessagedeleteWindow=null;
function messagedelete(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';primarymessagedeleteWindow=window.open('',myname+(new Date()).getTime(),settings);
if(infocus=='front'){primarymessagedeleteWindow.focus();primarymessagedeleteWindow.location=mypage;}
if(infocus=='back'){primarymessagedeleteWindow.blur();primarymessagedeleteWindow.location=mypage;primarymessagedeleteWindow.blur();}

}

var aliasaddWindow=null;
function aliasadd(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';aliasaddWindow=window.open('',myname,settings);
if(infocus=='front'){aliasaddWindow.focus();aliasaddWindow.location=mypage;}
if(infocus=='back'){aliasaddWindow.blur();aliasaddWindow.location=mypage;aliasaddWindow.blur();}

var timer = setInterval(function() {   
    if(aliasaddWindow.closed) {
        aliasaddWindow=null;
        clearInterval(timer);
        <?php
          $autores->deleteNotVerifiedAlias();
        ?>
    }
}, 1000);

}

var aliaseditWindow=null;
function aliasedit(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';aliaseditWindow=window.open('',myname,settings);
if(infocus=='front'){aliaseditWindow.focus();aliaseditWindow.location=mypage;}
if(infocus=='back'){aliaseditWindow.blur();aliaseditWindow.location=mypage;aliaseditWindow.blur();}

}

var aliasdeleteWindow=null;
function aliasdelete(mypage,myname,w,h,pos,infocus){

if (pos == 'random')
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
else
{LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';aliasdeleteWindow=window.open('',myname,settings);
if(infocus=='front'){aliasdeleteWindow.focus();aliasdeleteWindow.location=mypage;}
if(infocus=='back'){aliasdeleteWindow.blur();aliasdeleteWindow.location=mypage;aliasdeleteWindow.blur();}

}

// -->
</script>